﻿<UserControl x:Class="CBR.Views.XpsBookView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:Converters="clr-namespace:CBR.Components.Converters"
             xmlns:System_Windows_Documents="clr-namespace:System.Windows.Documents;assembly=PresentationUI"
             mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" Loaded="UserControl_Loaded">
	<UserControl.Resources>
		
		<Style x:Key="DocumentViewerStyle1" BasedOn="{x:Null}" TargetType="{x:Type DocumentViewer}">
			<Setter Property="Background" Value="{DynamicResource CbrDarkBackgroundBrush}"/>
			<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type DocumentViewer}">
						<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Focusable="False">
							<Grid Background="{TemplateBinding Background}" KeyboardNavigation.TabNavigation="Local">
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="*"/>
								</Grid.ColumnDefinitions>
								<Grid.RowDefinitions>
									<RowDefinition Height="Auto"/>
									<RowDefinition Height="*"/>
									<RowDefinition Height="Auto"/>
								</Grid.RowDefinitions>
								<ScrollViewer Style="{DynamicResource CbrScrollViewer}" x:Name="PART_ContentHost" CanContentScroll="true" Grid.Column="0" Focusable="{TemplateBinding Focusable}" HorizontalScrollBarVisibility="Auto" IsTabStop="true" Grid.Row="1" TabIndex="1"/>
								<DockPanel Grid.Row="1">
									<FrameworkElement DockPanel.Dock="Right" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
								</DockPanel>
							</Grid>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</UserControl.Resources>
    <Grid>
		<DocumentViewer Name="Viewer"
			Document="{Binding DocumentContent}"
			Zoom="{Binding Scale, Converter={x:Static Converters:ScaleToPercentConverter.Instance}, Mode=TwoWay, StringFormat=\{0:0\}%}"
			Style="{DynamicResource DocumentViewerStyle1}" />
    </Grid>
</UserControl>
